package com.lczyfz.campusinfo.modules.thirdpay.wxpay.impl;

import com.lczyfz.campusinfo.modules.thirdpay.wxpay.IWXPayDomain;
import com.lczyfz.campusinfo.modules.thirdpay.wxpay.WXPayConfig;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;


public class WXPayConfigImpl extends WXPayConfig{

    private byte[] certData;
    private static WXPayConfigImpl INSTANCE;
    public static boolean isPublicNumber = false;

    private WXPayConfigImpl() throws Exception {
//        String certPath = getClass().getResource("/cert/apiclient_cert.p12").getFile();
//        String certPath = getClass().getResource("/cert_pn/apiclient_cert.p12").getFile();
//        System.out.println("WXPayConfig 初始化 -------------" + certPath);
//        File file = new File(certPath);
//        InputStream certStream = new FileInputStream(file);
//        this.certData = new byte[(int) file.length()];
//        certStream.read(this.certData);
//        certStream.close();
    }

    public static WXPayConfigImpl getInstance() throws Exception {
        if (INSTANCE == null) {
            synchronized (WXPayConfigImpl.class) {
                if (INSTANCE == null) {
                    INSTANCE = new WXPayConfigImpl();
                }
            }
        }
        return INSTANCE;
    }
    @Override
    public String getAppID() {
        return "wxb56b1df8d42b57fb";
    }

    @Override
    public String getMchID() {
        return "1502158911";
    }

    @Override
    public String getKey() {
        return "campusinfocaD95ofZwacOmdqrMdTBe1";
    }

    @Override
    public InputStream getCertStream() {
        return null;
    }

    @Override
    public IWXPayDomain getWXPayDomain() {
        return null;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return super.getHttpConnectTimeoutMs();
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return super.getHttpReadTimeoutMs();
    }

    @Override
    public boolean shouldAutoReport() {
        return super.shouldAutoReport();
    }

    @Override
    public int getReportWorkerNum() {
        return super.getReportWorkerNum();
    }

    @Override
    public int getReportQueueMaxSize() {
        return super.getReportQueueMaxSize();
    }

    @Override
    public int getReportBatchSize() {
        return super.getReportBatchSize();
    }
}
